import { Suspense,useEffect } from "react"
import Nprogress from 'nprogress'
import 'nprogress/nprogress.css'
const Loading=()=>{
    useEffect(()=>{
        Nprogress.start()
        return ()=>{
            Nprogress.done()
        }
    },[])
    return <></>
}
const lazyLoad=(element:JSX.Element)=>{
    return <Suspense fallback={<Loading></Loading>}>
        {element}
    </Suspense>
}
export default lazyLoad